from redis import StrictRedis


class Config:
    # 开启调试模式
    DEBUG = None
    # 设置密钥
    SECRET_KEY = 'rPBJ8XQyHGnsorY4toyM5n/f+IwaIsdnep7mZhav35k='
    # 数据库连接
    SQLALCHEMY_DATABASE_URI = 'mysql://root:mysql@localhost/info333'
    # 数据库关闭动态追踪
    SQLALCHEMY_TRACK_MODIFICATIONS = False

    # REDIS主机及端口
    REDIS_HOST = '127.0.0.1'
    REDIS_PORT = 6379

    # 配置session信息存储模式
    SESSION_TYPE = 'redis'
    # 配置session存储的REDIS
    SESSION_REDIS = StrictRedis(host=REDIS_HOST, port=REDIS_PORT)
    # 配置session开启用户签名
    SESSION_USE_SIGNER = True
    # 配置session的过期时间
    PERMANENT_SESSION_LIFETIME = 86400


class developmentConfig(Config):
    DEBUG = True


class productionConfig(Config):
    DEBUG = False


config = {
    'development': developmentConfig,
    'production': productionConfig
}
